/*
 * AParameterPlotter.java
 *
 * Created on November 7, 2008, 12:11 PM
 */

package curro;

import sequor.model.ParameterListModel;
import specto.euclidean2.DESolution2D;
import specto.euclidean2.VectorField2D;

/**
 *
 * @author  ae3263
 */
public class PAVectorFieldPlotter extends javax.swing.JApplet {
    
    String[][] functions = { { "P(x,y)=" , "a*x+b*y+c", "x", "y" }, { "Q(x,y)=", "d*x+k*y+l", "x", "y" } };
    Object[][] parameters = { { "a", 1.0 }, { "b", 1.0 }, { "c", 0.0 }, { "d", -1.0 }, { "k", 0 }, { "l", 1.0 } };

    /** Initializes the applet AParameterPlotter */
    public void init() {
        try {
            java.awt.EventQueue.invokeAndWait(new Runnable() {
                public void run() {
                    initComponents();
       
                    parameterListModel1=new ParameterListModel(parameters, settingsPanel1, functionPanel1);
                    VectorField2D vf1 = new VectorField2D(functionPanel1.getFunctionModel(0), functionPanel1.getFunctionModel(1));
                    plot2D1.add(vf1);
                    plot2D1.add(new DESolution2D(vf1));
                    plot2D1.add(vf1.getStyleSlider("Field style",0,0),5,5);
                    plot2D1.repaint();
                }
            });
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /** This method is called from within the init() method to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        parameterListModel1 = new sequor.model.ParameterListModel();
        plot2D1 = new specto.euclidean2.Plot2D();
        settingsPanel1 = new sequor.component.SettingsPanel();
        functionPanel1 = new sequor.component.FunctionPanel(functions);

        plot2D1.setAxisStyle(1);

        javax.swing.GroupLayout plot2D1Layout = new javax.swing.GroupLayout(plot2D1);
        plot2D1.setLayout(plot2D1Layout);
        plot2D1Layout.setHorizontalGroup(
            plot2D1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 488, Short.MAX_VALUE)
        );
        plot2D1Layout.setVerticalGroup(
            plot2D1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 317, Short.MAX_VALUE)
        );

        getContentPane().add(plot2D1, java.awt.BorderLayout.CENTER);

        settingsPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters"));
        settingsPanel1.setPreferredSize(new java.awt.Dimension(250, 332));
        getContentPane().add(settingsPanel1, java.awt.BorderLayout.LINE_END);
        getContentPane().add(functionPanel1, java.awt.BorderLayout.PAGE_END);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private sequor.component.FunctionPanel functionPanel1;
    private sequor.model.ParameterListModel parameterListModel1;
    private specto.euclidean2.Plot2D plot2D1;
    private sequor.component.SettingsPanel settingsPanel1;
    // End of variables declaration//GEN-END:variables

}
